<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Bonds and Persistent Data Manager</title>
<link href="tabs.css" rel="stylesheet" type="text/css" />
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="alias.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="alias.js"></script>

<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>


<script type="text/javascript">
  jQuery(document).ready(function () {
    if(gref){ // Number all _img and _table classes
      gref();
    }
  });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">nRF51822 BLE SDK
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('group__ble__sdk__lib__bond__manager.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Bonds and Persistent Data Manager</div>  </div>
<div class="ingroups"><a class="el" href="group__ble__sdk__lib.html">Bluetooth Libraries</a></div></div>
<div class="contents">

<p>Module for handling multiple bonds.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__bond__manager.html#ga3996361c2235fe463273d331b8ea8678">ble_bondmngr_init</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the Bond Manager.  <a href="#ga3996361c2235fe463273d331b8ea8678"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__bond__manager.html#ga0602a76664be6f6f19997368d9cf8860">ble_bondmngr_on_ble_evt</a> (<a class="el" href="structble__evt__t.html">ble_evt_t</a> *p_ble_evt)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handles all events from the BLE stack that are of interest to this module.  <a href="#ga0602a76664be6f6f19997368d9cf8860"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__bond__manager.html#ga2f338b201c43be781a0194a97a243318">ble_bondmngr_on_goto_system_off</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to be called before going to system off, in order to save all bonded masters in flash memory.  <a href="#ga2f338b201c43be781a0194a97a243318"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__bond__manager.html#ga8e2aacd9f59e03d60b8db1ee0819c296">ble_bondmngr_master_delete</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Delete the bonded master database from flash.  <a href="#ga8e2aacd9f59e03d60b8db1ee0819c296"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>Module for handling multiple bonds. </p>
<p>Applications using the Bond Manager must have a configuration file named <a class="el" href="ble__bondmngr__cfg_8h_source.html">ble_bondmngr_cfg.h</a> (see <a class="el" href="group__ble__sdk__apps__config__files.html">'Config Files'</a> for details).</p>
<p>The Bond Manager interacts with the BLE stack by reacting to a set of BLE stack events, thus helping the application to bond with multiple masters.</p>
<p>Sequence diagrams illustrating the flow of events when connecting to a master using the Bond Manager:</p>
<div class="image">
<img src="bond_manager_unbonded_master.jpg" alt="bond_manager_unbonded_master.jpg"/>
<div class="caption">
Figure 1: Connecting to an unbonded master</div></div>
<p> <br/>
 </p>
<div class="image">
<img src="bond_manager_bonded_master.jpg" alt="bond_manager_bonded_master.jpg"/>
<div class="caption">
Figure 2: Connecting to a bonded master</div></div>
 <hr/><h2>Function Documentation</h2>
<a class="anchor" id="ga3996361c2235fe463273d331b8ea8678"></a><!-- doxytag: member="ble_bondmngr.h::ble_bondmngr_init" ref="ga3996361c2235fe463273d331b8ea8678" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t ble_bondmngr_init </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Initializes the Bond Manager. </p>
<p>On init, the Bond Manager reads the database of all bonded masters from flash. If the flash does not contain any valid data, the array of bonded masters in RAM will be emptied.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>Currently the Bond Manager uses only one page in flash.</dd></dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>NRF_SUCCESS if all operations went successfully, an error_code otherwise. </dd></dl>

<p>Definition at line <a class="el" href="ble__bondmngr_8c_source.html#l00235">235</a> of file <a class="el" href="ble__bondmngr_8c_source.html">ble_bondmngr.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga0602a76664be6f6f19997368d9cf8860"></a><!-- doxytag: member="ble_bondmngr.h::ble_bondmngr_on_ble_evt" ref="ga0602a76664be6f6f19997368d9cf8860" args="(ble_evt_t *p_ble_evt)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t ble_bondmngr_on_ble_evt </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structble__evt__t.html">ble_evt_t</a> *&#160;</td>
          <td class="paramname"><em>p_ble_evt</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Handles all events from the BLE stack that are of interest to this module. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">p_ble_evt</td><td>The event received from the BLE stack. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>NRF_SUCCESS if all operations went successfully, NRF_ERROR_NO_MEM if the maximum number of bonded master has been reached. Other error codes in other situations. </dd></dl>

<p>Definition at line <a class="el" href="ble__bondmngr_8c_source.html#l00265">265</a> of file <a class="el" href="ble__bondmngr_8c_source.html">ble_bondmngr.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga2f338b201c43be781a0194a97a243318"></a><!-- doxytag: member="ble_bondmngr.h::ble_bondmngr_on_goto_system_off" ref="ga2f338b201c43be781a0194a97a243318" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t ble_bondmngr_on_goto_system_off </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Function to be called before going to system off, in order to save all bonded masters in flash memory. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>This operation cannot be done while the radio is in a connection or is advertising.</dd></dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>NRF_SUCCESS if all operations went successfully, an error_code otherwise. </dd></dl>

<p>Definition at line <a class="el" href="ble__bondmngr_8c_source.html#l00222">222</a> of file <a class="el" href="ble__bondmngr_8c_source.html">ble_bondmngr.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga8e2aacd9f59e03d60b8db1ee0819c296"></a><!-- doxytag: member="ble_bondmngr.h::ble_bondmngr_master_delete" ref="ga8e2aacd9f59e03d60b8db1ee0819c296" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ble_bondmngr_master_delete </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Delete the bonded master database from flash. </p>
<p>After calling this function you should call <a class="el" href="group__ble__sdk__lib__bond__manager.html#ga3996361c2235fe463273d331b8ea8678" title="Initializes the Bond Manager.">ble_bondmngr_init()</a> to re-initialize the RAM database. </p>

<p>Definition at line <a class="el" href="ble__bondmngr_8c_source.html#l00110">110</a> of file <a class="el" href="ble__bondmngr_8c_source.html">ble_bondmngr.c</a>.</p>

</div>
</div>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


    <li class="footer">
      Copyright &copy 2006-2011 <a href="http://www.nordicsemi.no" style="text-decoration:none">Nordic Semiconductor</a>.
      All Rights Reserved.
      <a href="disclaimer.html">Disclaimer</a>
    </li>
   </ul>
 </div>


</body>
</html>
